package NowCoderHuaWei;

import java.util.Scanner;

public class Test05_02 {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
        while(in.hasNext())
	    {
        	String str1=in.next().substring(2);	
        	System.out.println(Integer.parseInt(str1,16));
	    }
        in.close();
	}

}
